{template 'header'}
<link href="{MODULE_URL}template/css/css.css" rel="stylesheet" />
<link href="{MODULE_URL}template/css/stylesheet.css" rel="stylesheet" />
<style type="text/css">
.list {
border-radius: 8px;
}
.list {
background: #fafafa;
padding: 10px;
margin: 5px;
}
.list .hd {
border-bottom: 1px #DDD dotted;
margin-bottom: 5px;
padding-bottom: 5px;
}
.list .content {
color: #545454;
line-height: 25px;
}
.list .reply {
background: #FFF;
border-top: 2px #769cdc solid;
padding: 10px;
margin-top: 10px;
overflow: hidden;
}
.list .content .author {
color: #999;
text-align: right;
margin-top: 10px;
}
</style>
{if $op == 'display'}
<a href="{php echo $this->createMobileUrl('report',array('op'=>'post'))}" class="top_menu">
    <img src="{MODULE_URL}template/image/fb.png" />投诉+
</a>
<div class="top_menu_shadow"></div>
{if empty($list)}
<div class="list img-rounded">没有任何投诉记录</div>
{/if}
<div id='list' style="margin-bottom:80px;">
{loop $list $item}
<div class="list img-rounded" {if $item['img']}style="height:200px;"{/if}>
  <div class="hd">
    <span class="title">{if intval($item['status'])==0}<p class="text-danger">未处理</p>{else}<p class="text-success">已处理</p>{/if}</span>
    <span class="date">{php echo date('Y-m-d H:i:s', $item['createtime']);}</span>
  </div>
  <div class="content">
    <p><span class="label label-warning">{$item['category']}</span> {$item['content']}</p>
    {if $item['img']}
    <p style='margin-top:5px;'>
        {loop $item['img'] $value}
            <img src="{$value['src']}" style="width: 60px; height: 60px;border:1px solid white;float:left;" />
        {/loop}
    </p>
    {/if}
  </div>
</div>
{/loop}
</div>
<div style="display:none;left: 0px;top: 0px;width: 100%;height: 100%;overflow: hidden;position: fixed;background: rgba(0, 0, 0, 0.5);" id="layer">

</div> 
{if count($list)>9}
<div style="margin-top:20px;margin-bottom:70px;text-align:center;font-size:16px;" id='view' >查看更多</div>
{/if}
<script>
var page = 2;
$(function() {
    $("#view").click(function() {
        $('#layer').show();
        obj=$(this);
        $(this).html('正在加载中...')
        $.get("{php echo $this->createMobileUrl('report',array('op'=>'more'))}&page="+page, function(result){
                    if(result!=''){
                        $('#list').append(result);
                        page++;    
                        obj.html('查看更多');
                    }else{
                        obj.html('没有更多信息了');
                    }
                    $('#layer').hide();
            });
        });
});
</script>
{/if}
{if $op == 'post'}
<!--仿微社区上传图片-->
        <link rel="stylesheet" href="{MODULE_URL}template/imgupload/css/comm.css">
        <script type="text/javascript" src="{MODULE_URL}template/imgupload/js/global.js">
        </script>
        <script type="text/javascript" src="{MODULE_URL}template/imgupload/js/gps.js">
        </script>
        <script type="text/javascript" src="{MODULE_URL}template/imgupload/js/seajs-0.1.5.js">
        </script>
        <script type="text/javascript" src="{MODULE_URL}template/imgupload/js/newthread.js">
        </script>
        <script type="text/javascript" charset="utf-8" src="{MODULE_URL}template/imgupload/js/jpegmeta.js">
        </script>
        <script type="text/javascript" charset="utf-8" src="{MODULE_URL}template/imgupload/js/jpeg.encoder.basic.js">
        </script>
        <script type="text/javascript" charset="utf-8" src="{MODULE_URL}template/imgupload/js/image_compress.js">
        </script>
        
<!--仿微社区上传图片-->
<!--仿微社区上传图片-->
        <script type="text/javascript">
            var myurl="{php echo $this->createMobileUrl('imgupload')}";
        </script>
<!--仿微社区上传图片-->
<form class="form-horizontal img-rounded" role="form" method="post" onsubmit="return checkInfo(this);" name="newthread" id="newthread">
<div class="panel panel-danger">
  <div class="panel-heading">
    <h3 class="panel-title">我要投诉</h3>
  </div>
  <div class="panel-body">
    <div class="form-group">
	    <label for="" class="col-sm-2 control-label">投诉类型</label>
	    <div class="col-sm-10">
	      <select name="category" class="form-control">
				{loop $categories  $category}
		
					<option value="{$category['name']}"{if $category['name']==$item['category']} selected{/if}>{$category['name']}</option>
					
				{/loop}
			</select>
	    </div>
 	</div>
 	<div class="form-group">
	    <label for="content" class="col-sm-2 control-label">投诉内容</label>
	    <div class="col-sm-10">
	     	<textarea name="content" id='content' class="form-control" rows="4">{$item['content']}</textarea>
	    </div>
 	</div>
  <div class="form-group">
      <label for="" class="col-sm-2 control-label">投诉图片(最多可上传3张图片)</label>
      <div class="col-sm-10">
          <div class="tipLayer">
              <div class="photoList">
                  <ul>
                      <li class="on" id="addPic">
                          <input type="file" class="on needsclick" style="z-index:200;opacity:0;filter:alpha(opacity=0);-ms-filter:'alpha(opacity=0)';" id="uploadFile" accept="image/*" single>
                      </li>
                  </ul>
              </div>
          </div>
      </div>
  </div>
 	<div class="form-group">
 		<label for="" class="col-sm-2 control-label"></label>
	    <div class="col-sm-10">
	     	<button type="submit" name="submit" value="yes" class="btn btn-primary btn-block" style="">提交</button>
			<input type="hidden" name="token" value="{$_W['token']}" />
	    </div>  
 	</div>
  </div>
</div>
</form>
{/if}

<script type="text/javascript">
function checkInfo(form) {
		if (!form['content'].value) {
			alert('请输入您的投诉内容。');
			return false;
		}
		return true;
	}


</script>
{template 'footer'}